package my.li.zhcswuliufront.controller;

import Vo.PropertyFee;
import Vo.WuLiu;
import land.RentHouseInterface;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import page.PageBean;
import util.JsonResult;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/wuliu")
public class WuLiuController {

    private RentHouseInterface feiginInterface;


    @RequestMapping("/")
    public String frist(HttpSession session){
        System.out.println("===========================================");
        session.setAttribute("wuLius",new ArrayList<WuLiu>());
        session.setAttribute("pagebean",new PageBean());
        return "wuliu_manager";
    }

    @RequestMapping("/getAll")
    public String getAllMes(PageBean pageBean, HttpServletRequest request){
        System.out.println("======================= 进行分页查询");
        HttpSession session = request.getSession();
        session.setAttribute("pagebean",pageBean);

        List<WuLiu> wuLius = new ArrayList<>();
        session.setAttribute("wuLius",wuLius);
        return "wuliu_manager";
    }

    @RequestMapping("/getByName")
    @ResponseBody
    public JsonResult queryById(WuLiu wuLiu){
//        util.JsonResult jsonResult = new util.JsonResult();
        System.out.println("getByNamewuLiu :  "+wuLiu);
        return JsonResult.successWithoutData();
    }


    @RequestMapping("/add")
    @ResponseBody
    public JsonResult addLand(WuLiu wuLiu){
        JsonResult jsonResult = new JsonResult();
        System.out.println("add : "+wuLiu);
        return JsonResult.successWithoutData();
    }

    @RequestMapping("wuliu_add")
    public String getAdd(WuLiu wuLiu){

        //查询
        return "wuliu_add";
    }

    @RequestMapping("deleteById")
    @ResponseBody
    public JsonResult deleteByLandId(WuLiu wuLiu){
        System.out.println("delete"+wuLiu);
        return JsonResult.successWithoutData();
    }

}
